﻿using Lhz.Sc.Entity.Database;
using System.Linq;

namespace Lhz.Sc.Business
{
    public static class UserQueryableExpansion
    {
        public static IQueryable<User> QueryByUsername(this IQueryable<User> query, string username)
        {
            if (!string.IsNullOrWhiteSpace(username))
            {
                query = query.Where(r => r.Username == username);
            }
            return query;
        }

        public static IQueryable<User> QueryByPassword(this IQueryable<User> query, string password)
        {
            if (!string.IsNullOrWhiteSpace(password))
            {
                query = query.Where(r => r.Password == password);
            }
            return query;
        }
    }
}
